{extend name="base" /}
{block name="body"}
<div class="layui-body">
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">
                <a href="{:url('admin/goods/index')}">商品列表</a>
            </li>
            <li>
                <a href="{:url('admin/goods/add')}">添加商品</a>
            </li>
        </ul>
        <div class="layui-tab-content">
            <form class="layui-form" action="{:url('admin/goods/index')}" method="post">
                <div class="layui-inline layui-form-pane">
                    <label class="layui-form-label">关键词</label>
                    <div class="layui-inline">
                        <input class="layui-input" type="text" name="keys" placeholder="请输入搜索关键词">
                    </div>
                </div>
                <div class="layui-inline">
                    <button class="layui-btn">搜索</button>
                </div>
            </form>
            <hr>

            <form action="" method="post" class="ajax-form">
                <button type="button" class="layui-btn layui-btn-danger ajax-action" data-action="{:url('admin/goods/changeStatus',['type'=>'down'])}">下架</button>
                <button type="button" class="layui-btn layui-btn-normal ajax-action" data-action="{:url('admin/goods/changeStatus',['type'=>'up'])}">上架</button>
                <button type="button" class="layui-btn layui-btn-danger ajax-action" data-action="{:url('admin/goods/changeStatus',['type'=>'recommend'])}">推荐</button>
                <button type="button" class="layui-btn layui-btn-normal ajax-action" data-action="{:url('admin/goods/changeStatus',['type'=>'no_recommend'])}">取消推荐</button>
                <div class="layui-tab-item layui-show">
                    <table class="layui-table">
                        <thead>
                        <tr>
                            <th><input type="checkbox" class="check-all"></th>
                            <th>ID</th>
                            <th>商品名称</th>
                            <th>商品原价</th>
                            <th>商品现价</th>
                            <th>缩略图</th>
                            <th>剩余库存</th>
                            <th>商品规格</th>
                            <th>上架状态</th>
                            <th>是否推荐</th>
                            <th>商品描述</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {foreach name="goods_list" item="vo"}
                        <tr>
                            <th><input type="checkbox" name="id[]" value="{$vo.id}"></th>
                            <th>{$vo.id}</th>
                            <th>{$vo.name}</th>
                            <th>{$vo.orgin_price}</th>
                            <th>{$vo.current_price}</th>
                            <th><img src="{$vo.thumb}" alt="暂无图片" width="60px" height="60px"></th>
                            <th>{$vo.stock}</th>
                            <th>{$vo.spec}</th>
                            <th>{php} echo $vo['is_up']==1 ? '上架' : '下架';{/php}</th>
                            <th>{php} echo $vo['is_recommend'] == 1? '已推荐' : '未推荐';{/php}</th>
                            <th>{$vo.description}</th>
                            <td>
                                <a href="{:url('admin/goods/edit',['id'=>$vo['id']])}" class="layui-btn layui-btn-warm">修改</a>
                            </td>
                        </tr>
                        {/foreach}
                        </tbody>
                    </table>
                    {$goods_list->render()}
                </div>
            </form>

        </div>
    </div>
</div>
{/block}
